/**
 * =============================================================================
 * ************   Bottom navigation 底部导航栏   ************
 * =============================================================================
 */

.mdui-bottom-nav {
  display: flex;
  position: relative;
  overflow: hidden;
  height: 56px;
  padding: 0;
  margin: 0 auto;
  white-space: nowrap;

  @media (min-width: @screen-sm-min) {
    &:before {
      content: ' ';
      flex-grow: 1;
    }
    &:after {
      content: ' ';
      flex-grow: 1;
    }
  }

  a {
    display: flex;
    color: inherit;
    text-decoration: none;
    font-size: 12px;

    text-align: center;
    cursor: pointer;
    text-overflow: ellipsis;
    overflow: hidden;
    user-select: none;
    opacity: 0.7;
    min-width: 32px;
    max-width: none;
    padding: 8px 12px 10px 12px;
    flex: 1;

    // 使图标和文本垂直排列
    flex-direction: column;
    justify-content: center;
    align-items: center;
    will-change: padding;
    transition: all .2s @animation-curve-default ;

    @media (min-width: @screen-sm-min) {
      max-width: 144px;
    }

    .mdui-icon {
      opacity: 0.7;
    }

    label {
      cursor: pointer;
      width: 100%;;
      display: block;
      will-change: font-size;
      transition: transform .2s @animation-curve-default ;
    }

    .mdui-icon + label {
      margin-top: 6px;
    }

    // 激活状态的导航项
    &.mdui-bottom-nav-active {
      color: @color-default-500;
      opacity: 1;
      font-size: 14px;

      .mdui-icon {
        opacity: 1;
      }
    }
  }
}

/* 只在激活时显示文本 */
&.mdui-bottom-nav-text-auto {
  a {
    padding-left: 0;
    padding-right: 0;
    min-width: 32px;
    @media (min-width: @screen-sm-min) {
      max-width: 156px;
    }
    .mdui-icon {
      padding-top: 16px;
      will-change: padding-top;
      transition: padding-top .2s @animation-curve-default;
    }
    label {
      transform: scale(0);
    }

    &.mdui-bottom-nav-active {
      padding-left: 18px;
      padding-right: 18px;
      .mdui-icon {
        padding-top: 0;
      }
      label {
        transform: scale(1);
      }
    }
  }
}

/* 固定到页面底部 */
.mdui-bottom-nav-fixed {
  .mdui-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  padding-bottom: 56px;
}

/**
 * =============================================================================
 * ************   Bottom Nav 主色   ************
 * =============================================================================
 */

& {
  .loop-primary-theme(@counter-color) when (@counter-color > 0) {
    .loop-primary-theme((@counter-color - 1));
    @colorName: extract(@globalPrimaryColors, @counter-color);
    @color: 'color-@{colorName}-500';

    .mdui-theme-primary-@{colorName} {
      .mdui-bottom-nav a.mdui-bottom-nav-active {
        color: @@color;
      }
    }

  }
  .loop-primary-theme(length(@globalPrimaryColors));
}

/* 带背景色的底部导航栏 */
.mdui-bottom-nav[class*="mdui-color-"] {
  .mdui-bottom-nav-active {
    color: inherit !important;
  }
}
